#define _CRT_SECURE_NO_WARNINGS 1
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<unordered_map>
#include<queue>
#include<stack>

using namespace std;

class Solution {
public:
    int lastStoneWeight(vector<int>& stones) {
        priority_queue<int> qt;
        for (auto& num : stones)
            qt.push(num);
        while (qt.size() >= 2)
        {
            int x = qt.top();
            qt.pop();
            int y = qt.top();
            qt.pop();
            qt.push(x - y);
        }
        if (qt.size()) return qt.top();
        else return 0;
    }
};

int main() {
    return 0;
}